import crypto from '@/core/crypto.js'

/**
 * 通过传入的参数获取设计页面的展示页面路径
 */
export const getDesignPath = (hostId, siteId, path = '/index.html') => {
  return (
    '/api/design/' +
    crypto.en('' + hostId) +
    '/' +
    crypto.en('' + siteId) +
    path
  )
}

export const getUriByDesign = (hostId, siteId, designPath) => {
  if (!designPath) {
    return false
  }
  return designPath.replace(
    '/api/design/' + crypto.en('' + hostId) + '/' + crypto.en('' + siteId),
    ''
  )
}

export const iframeRender = () => {
  return window.frames['iframeRender'].contentWindow
}
